﻿using Newtonsoft.Json;
using ThresholdAssistant.Enums;
using System;
using System.Text.Json.Serialization;

namespace ThresholdAssistant.DataContract.Param
{
    /// <summary>
    /// 机器人指令消息内容
    /// </summary>
    [Serializable]
    public class CmdMessageBody
    {
        /// <summary>
        /// 命令编码
        /// </summary>
        [JsonProperty("cmd"), JsonPropertyName("cmd")]
        public Enum Cmd { get; set; }

        /// <summary>
        /// 业务流水号
        /// </summary>
        [JsonProperty("serial_no"), JsonPropertyName("serial_no")]
        public string SerialNo { get; set; }

        /// <summary>
        /// 设备编号
        /// </summary>
        [JsonProperty("device_no"), JsonPropertyName("device_no")]
        public string DeviceNo { get; set; }

        /// <summary>
        /// 机器人Id
        /// </summary>
        [JsonProperty("robot_id"), JsonPropertyName("robot_id")]
        public string RobotId { get; set; }

        /// <summary>
        /// 程序编号
        /// </summary>
        [JsonProperty("user_serial_no"), JsonPropertyName("user_serial_no")]
        public string UserSerialNo { get; set; }

        /// <summary>
        /// 指令获取方式
        /// </summary>
        [JsonProperty("type"), JsonPropertyName("type")]
        public CmdTypeEnum Type { get; set; } = CmdTypeEnum.Default;
    }

    /// <summary>
    /// 机器人指令消息内容
    /// </summary>
    /// <typeparam name="T"></typeparam>
    [Serializable]
    public class CmdMessageBody<T> : CmdMessageBody where T : class
    {
        /// <summary>
        /// 指令Json参数
        /// </summary>
        [JsonProperty("data"), JsonPropertyName("data")]
        public T Data { get; set; }
    }
}